<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>随机题词器</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #e0f7fa, #bbdefb, #e3f2fd);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 20px 15px;
            overflow-x: hidden;
            position: relative;
        }
        
        /* 科技感背景装饰 */
        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: 
                radial-gradient(circle at 20% 30%, rgba(179, 229, 252, 0.2) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(187, 222, 251, 0.3) 0%, transparent 40%),
                radial-gradient(circle at 50% 20%, rgba(225, 245, 254, 0.25) 0%, transparent 40%);
            z-index: -1;
        }
        
        /* 顶部标题样式 */
        .header {
            margin: 25px 0 30px;
            text-align: center;
            position: relative;
            width: 100%;
        }
        
        .header h1 {
            font-size: 2.8rem;
            color: #0d47a1;
            text-shadow: 0 2px 10px rgba(33, 150, 243, 0.3);
            letter-spacing: 2px;
            position: relative;
            display: inline-block;
            font-weight: 700;
        }
        
        .header h1::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 10%;
            width: 80%;
            height: 4px;
            background: linear-gradient(90deg, transparent, #2196f3, transparent);
            border-radius: 2px;
        }
        
        /* 问题显示区域 */
        .question-container {
            width: 90%;
            max-width: 700px;
            min-height: 280px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 18px;
            box-shadow: 0 10px 30px rgba(33, 150, 243, 0.2);
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 25px;
            margin: 20px 0 40px;
            position: relative;
            overflow: hidden;
            border: 2px solid #bbdefb;
            transition: transform 0.3s ease;
        }
        
        .question-container:hover {
            transform: translateY(-5px);
        }
        
        /* 科技感边框效果 */
        .question-container::before {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: linear-gradient(45deg, #2196f3, #4fc3f7, #80d8ff, #29b6f6, #2196f3);
            background-size: 400%;
            border-radius: 20px;
            z-index: -1;
            animation: borderAnimation 8s linear infinite;
        }
        
        @keyframes borderAnimation {
            0% { background-position: 0 0; }
            100% { background-position: 400% 0; }
        }
        
        .question-box {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
            transition: all 0.5s ease;
        }
        
        .question-content {
            font-size: 1.9rem;
            color: #1565c0;
            line-height: 1.6;
            font-weight: 500;
            padding: 15px;
            transition: all 0.3s ease;
            word-break: break-word;
        }
        
        /* 初始状态提示 */
        .question-content.initial {
            color: #78909c;
            font-size: 1.6rem;
        }
        
        /* 结果放大效果 */
        .question-content.selected {
            font-size: 2.2rem;
            color: #0d47a1;
            text-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
            animation: pulse 1.5s ease;
        }
        
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
        
        /* 按钮区域 */
        .controls {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 25px;
            width: 100%;
            max-width: 500px;
            margin-top: 10px;
        }
        
        .btn {
            width: 240px;
            height: 65px;
            border: none;
            border-radius: 50px;
            font-size: 1.5rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
        }
        
        .btn-primary {
            background: linear-gradient(45deg, #2196f3, #1976d2);
            color: white;
        }
        
        .btn-primary:hover, .btn-primary:active {
            background: linear-gradient(45deg, #1976d2, #0d47a1);
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(33, 150, 243, 0.4);
        }
        
        .btn-reset {
            background: linear-gradient(45deg, #ff9800, #f57c00);
            color: white;
            display: none;
        }
        
        .btn-reset:hover, .btn-reset:active {
            background: linear-gradient(45deg, #f57c00, #e65100);
            transform: translateY(-3px);
        }
        
        /* 按钮波纹效果 */
        .ripple {
            position: absolute;
            background: rgba(255, 255, 255, 0.4);
            border-radius: 50%;
            transform: scale(0);
            animation: rippleEffect 0.6s linear;
        }
        
        @keyframes rippleEffect {
            to {
                transform: scale(4);
                opacity: 0;
            }
        }
        
        /* 计数显示 */
        .counter {
            font-size: 1.2rem;
            color: #0d47a1;
            font-weight: 500;
            background: rgba(255, 255, 255, 0.7);
            padding: 8px 25px;
            border-radius: 30px;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
            margin-top: 10px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        /* 进度指示器 */
        .progress-container {
            width: 90%;
            max-width: 700px;
            height: 12px;
            background: rgba(255, 255, 255, 0.6);
            border-radius: 10px;
            overflow: hidden;
            margin: 10px 0 20px;
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
        }
        
        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #4fc3f7, #2196f3);
            border-radius: 10px;
            width: 0%;
            transition: width 0.5s ease;
        }
        
        /* 抽题动画 */
        .rolling {
            animation: rolling 0.1s infinite linear;
        }
        
        @keyframes rolling {
            0% { opacity: 0.3; transform: translateY(20px); }
            100% { opacity: 1; transform: translateY(-20px); }
        }
        
        /* 响应式设计 */
        @media (max-width: 480px) {
            .header h1 {
                font-size: 2.2rem;
            }
            
            .question-container {
                min-height: 240px;
                padding: 20px;
            }
            
            .question-content {
                font-size: 1.6rem;
            }
            
            .question-content.initial {
                font-size: 1.4rem;
            }
            
            .question-content.selected {
                font-size: 1.8rem;
            }
            
            .btn {
                width: 220px;
                height: 58px;
                font-size: 1.3rem;
            }
        }
    </style>
</head>
<body>
    <div class="header">
        <h1><i class="fas fa-random"></i> 随机题词器</h1>
    </div>
    
    <div class="progress-container">
        <div class="progress-bar" id="progressBar"></div>
    </div>
    
    <div class="question-container">
        <div class="question-box">
            <div class="question-content initial" id="question">
                准备就绪，点击下方按钮开始抽取问题
            </div>
        </div>
    </div>
    
    <div class="controls">
        <button class="btn btn-primary" id="startBtn">
            <i class="fas fa-play"></i> 开始抽题
        </button>
        <button class="btn btn-reset" id="resetBtn">
            <i class="fas fa-redo"></i> 重置题词器
        </button>
        <div class="counter">
            <i class="fas fa-list-check"></i>
            <span id="counter">已抽取: 0/4 题</span>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 问题数据
            const questions = [
                "1. 如果用三个词形容你的大学生活，会是什么？为什么是这三个词？给你即将入学的学弟学妹们送一段话！",
                "2. 毕业之后有什么具体的打算吗？比如是准备留在恩施发展还是去其他城市闯一闯？送给自己一段话吧！",
                "3. 给10年之后的自己留个言",
                "4. 你会用什么方法长期保持对一件事的热情和行动力？"
            ];
            
            const questionElement = document.getElementById('question');
            const startBtn = document.getElementById('startBtn');
            const resetBtn = document.getElementById('resetBtn');
            const counterElement = document.getElementById('counter');
            const progressBar = document.getElementById('progressBar');
            
            let availableQuestions = [...questions];
            let selectedQuestions = [];
            let isRolling = false;
            let rollInterval;
            
            // 更新计数器和进度条
            function updateCounter() {
                const count = selectedQuestions.length;
                counterElement.textContent = `已抽取: ${count}/4 题`;
                progressBar.style.width = `${count * 25}%`;
            }
            
            // 创建按钮波纹效果
            function createRipple(event) {
                const btn = event.currentTarget;
                const circle = document.createElement("span");
                const diameter = Math.max(btn.clientWidth, btn.clientHeight);
                const radius = diameter / 2;
                
                circle.style.width = circle.style.height = `${diameter}px`;
                circle.style.left = `${event.clientX - btn.offsetLeft - radius}px`;
                circle.style.top = `${event.clientY - btn.offsetTop - radius}px`;
                circle.classList.add("ripple");
                
                const ripple = btn.getElementsByClassName("ripple")[0];
                if (ripple) ripple.remove();
                
                btn.appendChild(circle);
            }
            
            // 为按钮添加波纹效果
            startBtn.addEventListener('click', createRipple);
            resetBtn.addEventListener('click', createRipple);
            
            // 开始抽题
            startBtn.addEventListener('click', function() {
                if (isRolling || availableQuestions.length === 0) return;
                
                isRolling = true;
                questionElement.classList.remove('selected', 'initial');
                
                // 添加滚动动画
                questionElement.classList.add('rolling');
                startBtn.disabled = true;
                
                // 模拟问题快速切换效果
                let counter = 0;
                rollInterval = setInterval(() => {
                    // 在可用问题中随机显示
                    const randomIndex = Math.floor(Math.random() * availableQuestions.length);
                    questionElement.textContent = availableQuestions[randomIndex];
                    
                    counter++;
                    if (counter > 20) { // 约2秒后停止
                        clearInterval(rollInterval);
                        
                        // 随机选择一个问题
                        const selectedIndex = Math.floor(Math.random() * availableQuestions.length);
                        const selectedQuestion = availableQuestions[selectedIndex];
                        
                        // 更新问题列表
                        selectedQuestions.push(selectedQuestion);
                        availableQuestions.splice(selectedIndex, 1);
                        
                        // 显示最终结果
                        setTimeout(() => {
                            questionElement.textContent = selectedQuestion;
                            questionElement.classList.remove('rolling');
                            questionElement.classList.add('selected');
                            
                            // 更新UI
                            updateCounter();
                            isRolling = false;
                            startBtn.disabled = false;
                            
                            // 检查是否全部抽取完毕
                            if (availableQuestions.length === 0) {
                                startBtn.style.display = 'none';
                                resetBtn.style.display = 'flex';
                            }
                        }, 300);
                    }
                }, 100);
            });
            
            // 重置功能
            resetBtn.addEventListener('click', function() {
                availableQuestions = [...questions];
                selectedQuestions = [];
                questionElement.classList.remove('selected');
                questionElement.classList.add('initial');
                questionElement.textContent = "准备就绪，点击下方按钮开始抽取问题";
                resetBtn.style.display = 'none';
                startBtn.style.display = 'flex';
                updateCounter();
            });
            
            // 初始化计数器
            updateCounter();
        });
    </script>
</body>
</html>